//网格布局
package UserInterface;

import java.awt.*;
import javax.swing.*;

public class UserInterface5 {
    public static void main(String[] args) {

        JFrame win = new JFrame("win1");
        win.setSize(300, 200);
        win.setVisible(true);
        win.setTitle("网格布局实例");
        win.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        win.setLayout(new GridLayout(3, 2));
        win.validate();

        for (int i = 1; i <= 6; i++) {
            win.add(new JButton("按钮" + i));
        }
    }
}